<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Linguistic Constants</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
MathJax = {
	tex: {
		inlineMath: '$', '$'], ['\\(', '\\)'
	},
	svg: {
		fontCache: 'global'
	}
};
</script>
<script type="text/javascript" id="MathJax-script" async
	src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
</script>

<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Linguistic Constants' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../services.html">Services</a></li><li><a href="index.html">inflections</a></li><li><a href="index.html#3">Chapter 3: Declension and Conjugation</a></li><li><b>Linguistic Constants</b></li></ul></div>
<p class="purpose">Some basic linguistic constants are defined.</p>

<ul class="toc"><li><a href="3-lc.html#SP1">&#167;1. Constants</a></li><li><a href="3-lc.html#SP8">&#167;8. Packed references</a></li><li><a href="3-lc.html#SP11">&#167;11. Axes</a></li><li><a href="3-lc.html#SP14">&#167;14. Writing sets</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Constants.</b>First, we support three genders:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_KNOWN_GENDERS</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">NEUTER_GENDER</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax"> </span><span class="comment-syntax"> or can be used as Scandinavian "common gender"</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MASCULINE_GENDER</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">FEMININE_GENDER</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>There are six "persons". The sequence corresponds to the defined constants
in the English Language extension, which we assume will be followed by other
languages.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_KNOWN_PERSONS</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">FIRST_PERSON</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SECOND_PERSON</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">THIRD_PERSON</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>And two numbers:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_KNOWN_NUMBERS</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SINGULAR_NUMBER</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PLURAL_NUMBER</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>And two voices:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_KNOWN_VOICES</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ACTIVE_VOICE</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PASSIVE_VOICE</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>And two senses:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_KNOWN_SENSES</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">POSITIVE_SENSE</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">NEGATIVE_SENSE</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>25 cases sounds like plenty, but some languages are pretty scary this
way: Hungarian has 18. We only require two cases to exist, the nominative
and accusative, which are required to be cases 0 and 1.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MAX_GRAMMATICAL_CASES</span><span class="plain-syntax"> </span><span class="constant-syntax">25</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">NOMINATIVE_CASE</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ACCUSATIVE_CASE</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b>There are at least five tenses, the first four of which are used by Inform
in English. Some languages can use optional extras; French, for example, uses
tense 5 for the past historic.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_KNOWN_TENSES</span><span class="plain-syntax"> </span><span class="constant-syntax">7</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">IS_TENSE</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">       </span><span class="comment-syntax"> Present</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">WAS_TENSE</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">      </span><span class="comment-syntax"> Past</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">HASBEEN_TENSE</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">  </span><span class="comment-syntax"> Present perfect</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">HADBEEN_TENSE</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="plain-syntax">  </span><span class="comment-syntax"> Past perfect</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">WILLBE_TENSE</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span><span class="plain-syntax">   </span><span class="comment-syntax"> Future (not used in assertions or conditions)</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CUSTOM1_TENSE</span><span class="plain-syntax"> </span><span class="constant-syntax">5</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CUSTOM2_TENSE</span><span class="plain-syntax"> </span><span class="constant-syntax">6</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. Packed references.</b>The following enables even a 32-bit integer to hold an ID reference in the
range 0 to 128K, together with any combination of gender, person, number,
voice, case, tense, and sense. This could be optimised further, exploiting
for example that no grammatical concept ever simultaneously has voice and
gender, but it seems unlikely that there's any need.
</p>

<p class="commentary">If the 128K limit on references ever becomes problematic, which seems very
unlikely, we might compromise on the number of cases; or we might simply
change <span class="extract"><span class="extract-syntax">lcon_ti</span></span> to a wider integer type. (It needs to have value copy
semantics.) If so, though, Preform results will also need to be widened,
because numerous Preform nonterminals in <a href="../linguistics-module/index.html" class="internal">linguistics</a> return <span class="extract"><span class="extract-syntax">lcon_ti</span></span>
values, and at present Preform return values are <span class="extract"><span class="extract-syntax">int</span></span>.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="reserved-syntax">int</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>And here's how we pack everything in:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">            &lt;-- </span><span class="identifier-syntax">lsb</span><span class="plain-syntax">     </span><span class="constant-syntax">32</span><span class="plain-syntax"> </span><span class="identifier-syntax">bits</span><span class="plain-syntax">      </span><span class="identifier-syntax">msb</span><span class="plain-syntax"> --&gt;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">gender</span><span class="plain-syntax">  </span><span class="identifier-syntax">xx</span><span class="plain-syntax">..............................</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">person</span><span class="plain-syntax">  ..</span><span class="identifier-syntax">xx</span><span class="plain-syntax">............................</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">number</span><span class="plain-syntax">  ....</span><span class="identifier-syntax">x</span><span class="plain-syntax">...........................</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">voice</span><span class="plain-syntax">   .....</span><span class="identifier-syntax">x</span><span class="plain-syntax">..........................</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">case</span><span class="plain-syntax">    ......</span><span class="identifier-syntax">xxxxx</span><span class="plain-syntax">.....................</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">tense</span><span class="plain-syntax">   ...........</span><span class="identifier-syntax">xxx</span><span class="plain-syntax">..................</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sense</span><span class="plain-syntax">   ..............</span><span class="identifier-syntax">x</span><span class="plain-syntax">.................</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">      ...............</span><span class="identifier-syntax">xxxxxxxxxxxxxxxxx</span>
</pre>
<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">GENDER_LCBASE</span><span class="plain-syntax"> </span><span class="constant-syntax">0x00000001</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">GENDER_LCMASK</span><span class="plain-syntax"> </span><span class="constant-syntax">0x00000003</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PERSON_LCBASE</span><span class="plain-syntax"> </span><span class="constant-syntax">0x00000004</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PERSON_LCMASK</span><span class="plain-syntax"> </span><span class="constant-syntax">0x0000000C</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">NUMBER_LCBASE</span><span class="plain-syntax"> </span><span class="constant-syntax">0x00000010</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">NUMBER_LCMASK</span><span class="plain-syntax"> </span><span class="constant-syntax">0x00000010</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">VOICE_LCBASE</span><span class="plain-syntax">  </span><span class="constant-syntax">0x00000020</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">VOICE_LCMASK</span><span class="plain-syntax">  </span><span class="constant-syntax">0x00000020</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CASE_LCBASE</span><span class="plain-syntax">   </span><span class="constant-syntax">0x00000040</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CASE_LCMASK</span><span class="plain-syntax">   </span><span class="constant-syntax">0x000007C0</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">TENSE_LCBASE</span><span class="plain-syntax">  </span><span class="constant-syntax">0x00000800</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">TENSE_LCMASK</span><span class="plain-syntax">  </span><span class="constant-syntax">0x00003800</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SENSE_LCBASE</span><span class="plain-syntax">  </span><span class="constant-syntax">0x00004000</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SENSE_LCMASK</span><span class="plain-syntax">  </span><span class="constant-syntax">0x00004000</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ID_LCBASE</span><span class="plain-syntax">     </span><span class="constant-syntax">0x00008000</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ID_LCUNMASK</span><span class="plain-syntax">   </span><span class="constant-syntax">0x00007FFF</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::base</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">Lcon::base</span></span>:<br/>Declensions - <a href="3-dcl.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax">) </span><span class="constant-syntax">0</span><span class="plain-syntax">; }</span>
<span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::of_id</span><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">id</span><span class="plain-syntax">) { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">id</span><span class="plain-syntax">*</span><span class="constant-syntax">ID_LCBASE</span><span class="plain-syntax">; }</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::get_id</span><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">)     { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">l</span><span class="plain-syntax">/</span><span class="constant-syntax">ID_LCBASE</span><span class="plain-syntax">; }</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::get_gender</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">Lcon::get_gender</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a><br/>Lexical Clusters - <a href="3-lc2.html#SP9">&#167;9</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">) { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">GENDER_LCMASK</span><span class="plain-syntax">) / </span><span class="constant-syntax">GENDER_LCBASE</span><span class="plain-syntax">; }</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::get_person</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">Lcon::get_person</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">) { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">PERSON_LCMASK</span><span class="plain-syntax">) / </span><span class="constant-syntax">PERSON_LCBASE</span><span class="plain-syntax">; }</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::get_number</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">Lcon::get_number</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a><br/>Lexical Clusters - <a href="3-lc2.html#SP9">&#167;9</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">) { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">NUMBER_LCMASK</span><span class="plain-syntax">) / </span><span class="constant-syntax">NUMBER_LCBASE</span><span class="plain-syntax">; }</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::get_voice</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">Lcon::get_voice</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">)   { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">VOICE_LCMASK</span><span class="plain-syntax">) / </span><span class="constant-syntax">VOICE_LCBASE</span><span class="plain-syntax">; }</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::get_case</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">Lcon::get_case</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">)   { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">CASE_LCMASK</span><span class="plain-syntax">) / </span><span class="constant-syntax">CASE_LCBASE</span><span class="plain-syntax">; }</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::get_tense</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">Lcon::get_tense</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">)  { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">TENSE_LCMASK</span><span class="plain-syntax">) / </span><span class="constant-syntax">TENSE_LCBASE</span><span class="plain-syntax">; }</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::get_sense</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">Lcon::get_sense</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">)  { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">SENSE_LCMASK</span><span class="plain-syntax">) / </span><span class="constant-syntax">SENSE_LCBASE</span><span class="plain-syntax">; }</span>

<span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::set_id</span><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">id</span><span class="plain-syntax">) { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">ID_LCUNMASK</span><span class="plain-syntax">) + </span><span class="identifier-syntax">id</span><span class="plain-syntax">*</span><span class="constant-syntax">ID_LCBASE</span><span class="plain-syntax">; }</span>
<span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::set_gender</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">Lcon::set_gender</span></span>:<br/>Declensions - <a href="3-dcl.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">) { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; (~</span><span class="constant-syntax">GENDER_LCMASK</span><span class="plain-syntax">)) + </span><span class="identifier-syntax">x</span><span class="plain-syntax">*</span><span class="constant-syntax">GENDER_LCBASE</span><span class="plain-syntax">; }</span>
<span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::set_person</span><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">) { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; (~</span><span class="constant-syntax">PERSON_LCMASK</span><span class="plain-syntax">)) + </span><span class="identifier-syntax">x</span><span class="plain-syntax">*</span><span class="constant-syntax">PERSON_LCBASE</span><span class="plain-syntax">; }</span>
<span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::set_number</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">Lcon::set_number</span></span>:<br/>Declensions - <a href="3-dcl.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">) { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; (~</span><span class="constant-syntax">NUMBER_LCMASK</span><span class="plain-syntax">)) + </span><span class="identifier-syntax">x</span><span class="plain-syntax">*</span><span class="constant-syntax">NUMBER_LCBASE</span><span class="plain-syntax">; }</span>
<span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::set_voice</span><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">)   { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; (~</span><span class="constant-syntax">VOICE_LCMASK</span><span class="plain-syntax">)) + </span><span class="identifier-syntax">x</span><span class="plain-syntax">*</span><span class="constant-syntax">VOICE_LCBASE</span><span class="plain-syntax">; }</span>
<span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::set_case</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">Lcon::set_case</span></span>:<br/>Declensions - <a href="3-dcl.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">)   { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; (~</span><span class="constant-syntax">CASE_LCMASK</span><span class="plain-syntax">)) + </span><span class="identifier-syntax">x</span><span class="plain-syntax">*</span><span class="constant-syntax">CASE_LCBASE</span><span class="plain-syntax">; }</span>
<span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::set_tense</span><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">)  { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; (~</span><span class="constant-syntax">TENSE_LCMASK</span><span class="plain-syntax">)) + </span><span class="identifier-syntax">x</span><span class="plain-syntax">*</span><span class="constant-syntax">TENSE_LCBASE</span><span class="plain-syntax">; }</span>
<span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::set_sense</span><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">)  { </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">l</span><span class="plain-syntax"> &amp; (~</span><span class="constant-syntax">SENSE_LCMASK</span><span class="plain-syntax">)) + </span><span class="identifier-syntax">x</span><span class="plain-syntax">*</span><span class="constant-syntax">SENSE_LCBASE</span><span class="plain-syntax">; }</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::write_person</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">Lcon::write_person</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">p</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">p</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">FIRST_PERSON:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"1p"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">SECOND_PERSON:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"2p"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">THIRD_PERSON:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"3p"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::write_number</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">Lcon::write_number</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">SINGULAR_NUMBER:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"s"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PLURAL_NUMBER:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::write_gender</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">Lcon::write_gender</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">g</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">g</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NEUTER_GENDER:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">MASCULINE_GENDER:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"m"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">FEMININE_GENDER:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"f"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::write_sense</span><button class="popup" onclick="togglePopup('usagePopup15')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup15">Usage of <span class="code-font"><span class="function-syntax">Lcon::write_sense</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">s</span><span class="plain-syntax"> == </span><span class="constant-syntax">NEGATIVE_SENSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"-ve"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">s</span><span class="plain-syntax"> == </span><span class="constant-syntax">POSITIVE_SENSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"+ve"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::write_voice</span><button class="popup" onclick="togglePopup('usagePopup16')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup16">Usage of <span class="code-font"><span class="function-syntax">Lcon::write_voice</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">m</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax"> == </span><span class="constant-syntax">ACTIVE_VOICE</span><span class="plain-syntax">)  </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"act"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">m</span><span class="plain-syntax"> == </span><span class="constant-syntax">PASSIVE_VOICE</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"pass"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::write_tense</span><button class="popup" onclick="togglePopup('usagePopup17')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup17">Usage of <span class="code-font"><span class="function-syntax">Lcon::write_tense</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">IS_TENSE:</span><span class="plain-syntax">      </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"IS_TENSE"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">WAS_TENSE:</span><span class="plain-syntax">     </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"WAS_TENSE"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">HASBEEN_TENSE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"HASBEEN_TENSE"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">HADBEEN_TENSE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"HADBEEN_TENSE"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">WILLBE_TENSE:</span><span class="plain-syntax">  </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"WILLBE_TENSE"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CUSTOM1_TENSE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"CUSTOM1_TENSE"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CUSTOM2_TENSE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"CUSTOM2_TENSE"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;invalid-tense&gt;"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::write_case</span><button class="popup" onclick="togglePopup('usagePopup18')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup18">Usage of <span class="code-font"><span class="function-syntax">Lcon::write_case</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOMINATIVE_CASE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"nom"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ACCUSATIVE_CASE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"acc"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax">              </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"case%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::same_but_for_gender</span><button class="popup" onclick="togglePopup('usagePopup19')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup19">Usage of <span class="code-font"><span class="function-syntax">Lcon::same_but_for_gender</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">A</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">GENDER_LCMASK</span><span class="plain-syntax">)) == (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">GENDER_LCMASK</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::same_but_for_person</span><button class="popup" onclick="togglePopup('usagePopup20')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup20">Usage of <span class="code-font"><span class="function-syntax">Lcon::same_but_for_person</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">A</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">PERSON_LCMASK</span><span class="plain-syntax">)) == (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">PERSON_LCMASK</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::same_but_for_number</span><button class="popup" onclick="togglePopup('usagePopup21')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup21">Usage of <span class="code-font"><span class="function-syntax">Lcon::same_but_for_number</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">A</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">NUMBER_LCMASK</span><span class="plain-syntax">)) == (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">NUMBER_LCMASK</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::same_but_for_voice</span><button class="popup" onclick="togglePopup('usagePopup22')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup22">Usage of <span class="code-font"><span class="function-syntax">Lcon::same_but_for_voice</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">A</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">VOICE_LCMASK</span><span class="plain-syntax">)) == (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">VOICE_LCMASK</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::same_but_for_case</span><button class="popup" onclick="togglePopup('usagePopup23')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup23">Usage of <span class="code-font"><span class="function-syntax">Lcon::same_but_for_case</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">A</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">CASE_LCMASK</span><span class="plain-syntax">)) == (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">CASE_LCMASK</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::same_but_for_tense</span><button class="popup" onclick="togglePopup('usagePopup24')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup24">Usage of <span class="code-font"><span class="function-syntax">Lcon::same_but_for_tense</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">A</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">TENSE_LCMASK</span><span class="plain-syntax">)) == (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">TENSE_LCMASK</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::same_but_for_sense</span><button class="popup" onclick="togglePopup('usagePopup25')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup25">Usage of <span class="code-font"><span class="function-syntax">Lcon::same_but_for_sense</span></span>:<br/><a href="3-lc.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">A</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">SENSE_LCMASK</span><span class="plain-syntax">)) == (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">B</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">SENSE_LCMASK</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. Axes.</b>We can think of a combination of the seven grammatical attributes above as
being like a position in seven-dimensional space, with each being a coordinate
on one of these seven axes.
</p>

<p class="commentary">In practice, we're often interested in only a few of the seven. Nouns, for
instance, do not have tenses; verbs do not have cases. It's convenient to
represent the seven axes by the following constants, so that an arbitrary
sum of these can represent a set of things we're interested in:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">GENDER_LCW</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PERSON_LCW</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">NUMBER_LCW</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">VOICE_LCW</span><span class="plain-syntax">  </span><span class="constant-syntax">8</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CASE_LCW</span><span class="plain-syntax">   </span><span class="constant-syntax">16</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">TENSE_LCW</span><span class="plain-syntax">  </span><span class="constant-syntax">32</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SENSE_LCW</span><span class="plain-syntax">  </span><span class="constant-syntax">64</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. </b>And <span class="extract"><span class="extract-syntax">desiderata</span></span> in the following function is exactly that sort of set.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::write</span><button class="popup" onclick="togglePopup('usagePopup26')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup26">Usage of <span class="code-font"><span class="function-syntax">Lcon::write</span></span>:<br/><a href="3-lc.html#SP16_1_2">&#167;16.1.2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">l</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">desiderata</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">axis</span><span class="plain-syntax">=1; </span><span class="identifier-syntax">axis</span><span class="plain-syntax">&lt;128; </span><span class="identifier-syntax">axis</span><span class="plain-syntax">=</span><span class="identifier-syntax">axis</span><span class="plain-syntax">*2)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">desiderata</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">axis</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="3-lc.html#SP13" class="function-link"><span class="function-syntax">Lcon::write_value_on_axis</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">axis</span><span class="plain-syntax">, </span><a href="3-lc.html#SP13" class="function-link"><span class="function-syntax">Lcon::get_value_on_axis</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">axis</span><span class="plain-syntax">, </span><span class="identifier-syntax">l</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. </b>The parameter <span class="extract"><span class="extract-syntax">axis</span></span> in the following must, on the other hand, be a pure power
of 2, that is, it must be a single <span class="extract"><span class="extract-syntax">*_LCW</span></span> value.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::write_value_on_axis</span><button class="popup" onclick="togglePopup('usagePopup27')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup27">Usage of <span class="code-font"><span class="function-syntax">Lcon::write_value_on_axis</span></span>:<br/><a href="3-lc.html#SP12">&#167;12</a>, <a href="3-lc.html#SP16_1_2">&#167;16.1.2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">axis</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">v</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">axis</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">GENDER_LCW:</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::write_gender</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">v</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PERSON_LCW:</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::write_person</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">v</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NUMBER_LCW:</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::write_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">v</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">VOICE_LCW:</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::write_voice</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">v</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CASE_LCW:</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::write_case</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">v</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TENSE_LCW:</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::write_tense</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">v</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">SENSE_LCW:</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::write_sense</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">v</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"bad axis"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::get_value_on_axis</span><button class="popup" onclick="togglePopup('usagePopup28')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup28">Usage of <span class="code-font"><span class="function-syntax">Lcon::get_value_on_axis</span></span>:<br/><a href="3-lc.html#SP12">&#167;12</a>, <a href="3-lc.html#SP16_1_1_1_1">&#167;16.1.1.1.1</a>, <a href="3-lc.html#SP16_1_1_1_2">&#167;16.1.1.1.2</a>, <a href="3-lc.html#SP16_1_2">&#167;16.1.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">axis</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">axis</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">GENDER_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::get_gender</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PERSON_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::get_person</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NUMBER_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::get_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">VOICE_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::get_voice</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CASE_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::get_case</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TENSE_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::get_tense</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">SENSE_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP9" class="function-link"><span class="function-syntax">Lcon::get_sense</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"bad axis"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::same_but_for_value_on_axis</span><button class="popup" onclick="togglePopup('usagePopup29')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup29">Usage of <span class="code-font"><span class="function-syntax">Lcon::same_but_for_value_on_axis</span></span>:<br/><a href="3-lc.html#SP16_1_1_1_1">&#167;16.1.1.1.1</a>, <a href="3-lc.html#SP16_1_1_1_2">&#167;16.1.1.1.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">axis</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">axis</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">GENDER_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP10" class="function-link"><span class="function-syntax">Lcon::same_but_for_gender</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PERSON_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP10" class="function-link"><span class="function-syntax">Lcon::same_but_for_person</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NUMBER_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP10" class="function-link"><span class="function-syntax">Lcon::same_but_for_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">VOICE_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP10" class="function-link"><span class="function-syntax">Lcon::same_but_for_voice</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CASE_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP10" class="function-link"><span class="function-syntax">Lcon::same_but_for_case</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TENSE_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP10" class="function-link"><span class="function-syntax">Lcon::same_but_for_tense</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">SENSE_LCW:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-lc.html#SP10" class="function-link"><span class="function-syntax">Lcon::same_but_for_sense</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"bad axis"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. Writing sets.</b>Suppose we have a list of <span class="extract"><span class="extract-syntax">lcon_ti</span></span> constants and want to print out their
grammatical attributes. If we do that in the obvious way, by calling
<a href="3-lc.html#SP12" class="internal">Lcon::write</a> on each of the constants in turn, we tend to get a list
of tiresome length. We want to abbreviate so that, e.g.,
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="constant-syntax">1</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">p</span><span class="plain-syntax"> + </span><span class="constant-syntax">2</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> + </span><span class="constant-syntax">2</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">p</span><span class="plain-syntax"> + </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> + </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">p</span>
</pre>
<p class="commentary">becomes just <span class="extract"><span class="extract-syntax">1p/2p/3p s/p</span></span>.
</p>

<p class="commentary">Doing this is surprisingly non-trivial: an optimal solution means finding
the minimal number of disjoint 7-dimensional cuboids whose union is the
set of coordinates in the list. "Cuboid" here really means "Cartesian
product of seven sets"; the above case is a benign one because the set
in question is a single cuboid &mdash;
$$ \lbrace (1p, s), (2p, s), (3p, s), (1p, p), (2p, p), (3p, p) \rbrace = \lbrace 1p, 2p, 3p \rbrace\times\lbrace s, p\rbrace. $$
</p>

<p class="commentary">We will aim for an adequately good answer, not an optimal one. The following
code is really only needed for printing tidy debugging and test logs, so
it's probably not worth any further effort.
</p>

<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. </b>To avoid the C extension for variable-length arrays, and to avoid memory
allocation, we're simply going to make our working arrays quite large. But
this is fine &mdash; the function is for printing, so it's not used much.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MAX_LCON_SET_SIZE</span>
<span class="plain-syntax">    </span><span class="constant-syntax">NO_KNOWN_GENDERS</span><span class="plain-syntax">*</span><span class="constant-syntax">NO_KNOWN_PERSONS</span><span class="plain-syntax">*</span><span class="constant-syntax">NO_KNOWN_NUMBERS</span><span class="plain-syntax">*</span><span class="constant-syntax">NO_KNOWN_VOICES</span><span class="plain-syntax">*</span>
<span class="plain-syntax">        </span><span class="constant-syntax">NO_KNOWN_SENSES</span><span class="plain-syntax">*</span><span class="constant-syntax">MAX_GRAMMATICAL_CASES</span><span class="plain-syntax">*</span><span class="constant-syntax">NO_KNOWN_TENSES</span>
</pre>
<p class="commentary firstcommentary"><a id="SP16" class="paragraph-anchor"></a><b>&#167;16. </b>We are going to aggregate items in the list into numbered cuboids. The
strategy is simple: start with the first item; make the largest-volume cuboid
inside our set which contains that item; then take the next item not already
included, and continue.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Lcon::write_set</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> *</span><span class="identifier-syntax">set</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">set_size</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">desiderata</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">set_size</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">MAX_LCON_SET_SIZE</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"lcon set too large"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cuboid_number</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_LCON_SET_SIZE</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">set_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">cuboid_number</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0, </span><span class="identifier-syntax">cuboid</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">set_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cuboid_number</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] == -1) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cuboid</span><span class="plain-syntax">++ &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" +"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="3-lc.html#SP16_1" class="named-paragraph-link"><span class="named-paragraph">Find the most volumetric cuboid containing this form</span><span class="named-paragraph-number">16.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP16_1" class="paragraph-anchor"></a><b>&#167;16.1. </b>Note that there is always at least one cuboid containing the item \(i\) &mdash;
the \(1\times 1\times 1\times 1\times 1\times 1\times 1\) cuboid containing
just that one point. So the following certainly finds something. The
<span class="extract"><span class="extract-syntax">elongated_sides</span></span> value accumulates the set of axis directions in which
the cuboid is longer than 1.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Find the most volumetric cuboid containing this form</span><span class="named-paragraph-number">16.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">cuboid_number</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">cuboid</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">elongated_sides</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-lc.html#SP16_1_1" class="named-paragraph-link"><span class="named-paragraph">Repeatedly elongate in the axis which maximises the volume growth</span><span class="named-paragraph-number">16.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-lc.html#SP16_1_2" class="named-paragraph-link"><span class="named-paragraph">Write the resulting cuboid out</span><span class="named-paragraph-number">16.1.2</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-lc.html#SP16">&#167;16</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP16_1_1" class="paragraph-anchor"></a><b>&#167;16.1.1. </b>So now we are at item \(i\). We repeatedly do the following: try to expand
the cuboid into each of the seven axis directions, then choose the one
which expands it the most. We stop when no further expansion is possible.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Repeatedly elongate in the axis which maximises the volume growth</span><span class="named-paragraph-number">16.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">max_elongation</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">do</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">best_d</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">max_elongation</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">enlarged</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_LCON_SET_SIZE</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">d</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">128</span><span class="plain-syntax">; </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">d</span><span class="plain-syntax">*2) </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">d</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">desiderata</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">elongation</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="3-lc.html#SP16_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Enlarge the cuboid in axis direction d</span><span class="named-paragraph-number">16.1.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">max_elongation</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">elongation</span><span class="plain-syntax">) { </span><span class="identifier-syntax">max_elongation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">elongation</span><span class="plain-syntax">; </span><span class="identifier-syntax">best_d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">d</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">best_d</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">elongated_sides</span><span class="plain-syntax"> = </span><span class="identifier-syntax">elongated_sides</span><span class="plain-syntax"> | </span><span class="identifier-syntax">best_d</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">best_d</span><span class="plain-syntax">, </span><span class="identifier-syntax">elongation</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="3-lc.html#SP16_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Enlarge the cuboid in axis direction d</span><span class="named-paragraph-number">16.1.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">set_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) </span><span class="identifier-syntax">cuboid_number</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">] = </span><span class="identifier-syntax">enlarged</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">max_elongation</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-lc.html#SP16_1">&#167;16.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP16_1_1_1" class="paragraph-anchor"></a><b>&#167;16.1.1.1. </b>We start with the current cuboid. The <span class="extract"><span class="extract-syntax">enlarged</span></span> array will be the same as
the <span class="extract"><span class="extract-syntax">cuboid_number</span></span> array except that some additional points <span class="extract"><span class="extract-syntax">x</span></span> for which
<span class="extract"><span class="extract-syntax">cuboid_number[x]</span></span> is \(-1\) &mdash; i.e., points not yet placed in any cuboid &mdash;
will have <span class="extract"><span class="extract-syntax">enlarged[x]</span></span> set to <span class="extract"><span class="extract-syntax">cuboid</span></span> &mdash; i.e., will be placed in the current
cuboid. In effect, <span class="extract"><span class="extract-syntax">enlarged</span></span> is a speculative next version of <span class="extract"><span class="extract-syntax">cuboid_number</span></span>.
</p>

<p class="commentary">We first find the "variations" in the \(d\) direction: that is, \(d\) coordinates
of points which are either \(i\) itself or are unplaced points whose other
coordinates are the same as those for \(i\).
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Enlarge the cuboid in axis direction d</span><span class="named-paragraph-number">16.1.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">set_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) </span><span class="identifier-syntax">enlarged</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">] = </span><span class="identifier-syntax">cuboid_number</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">variations</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_LCON_SET_SIZE</span><span class="plain-syntax">], </span><span class="identifier-syntax">no_vars</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-lc.html#SP16_1_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Find all the variations on axis d from position i</span><span class="named-paragraph-number">16.1.1.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">allow</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-lc.html#SP16_1_1_1_2" class="named-paragraph-link"><span class="named-paragraph">Check every position has the same variations, and elongate by them</span><span class="named-paragraph-number">16.1.1.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">allow</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">elongation</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-lc.html#SP16_1_1">&#167;16.1.1</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP16_1_1_1_1" class="paragraph-anchor"></a><b>&#167;16.1.1.1.1. </b>For example, if \(i = (2, 1, 0, 0, 0, 0, 0)\) and \(d\) is the second axis, then
one variation would be 1 (the \(d\) coordinate of \(i\) itself) and if, say,
\((2, 7, 0, 0, 0, 0, 0)\) were an unplaced point then 7 would also be a variation.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Find all the variations on axis d from position i</span><span class="named-paragraph-number">16.1.1.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">no_vars</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">set_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">cuboid_number</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">] &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="identifier-syntax">i</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax"> = </span><span class="identifier-syntax">set</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">], </span><span class="identifier-syntax">B</span><span class="plain-syntax"> = </span><span class="identifier-syntax">set</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-lc.html#SP13" class="function-link"><span class="function-syntax">Lcon::same_but_for_value_on_axis</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">d</span><span class="plain-syntax">, </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">variations</span><span class="plain-syntax">[</span><span class="identifier-syntax">no_vars</span><span class="plain-syntax">++] = </span><a href="3-lc.html#SP13" class="function-link"><span class="function-syntax">Lcon::get_value_on_axis</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">d</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-lc.html#SP16_1_1_1">&#167;16.1.1.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP16_1_1_1_2" class="paragraph-anchor"></a><b>&#167;16.1.1.1.2. </b>Now suppose our variation set is indeed \(\lbrace 1, 7\rbrace\), as in the
above example. The idea is that we will use this set as the new side for the
cuboid. We know that we can vary \(i\) by these values; that's how they were
found. But we must also check that we can vary every other point currently
in the cuboid in the same way. If we can't, the attempt fails.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Check every position has the same variations, and elongate by them</span><span class="named-paragraph-number">16.1.1.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">k</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">set_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">k</span><span class="plain-syntax">++) </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cuboid_number</span><span class="plain-syntax">[</span><span class="identifier-syntax">k</span><span class="plain-syntax">] == </span><span class="identifier-syntax">cuboid</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">vc</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">vc</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">no_vars</span><span class="plain-syntax">; </span><span class="identifier-syntax">vc</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">v</span><span class="plain-syntax"> = </span><span class="identifier-syntax">variations</span><span class="plain-syntax">[</span><span class="identifier-syntax">vc</span><span class="plain-syntax">], </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">set_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">cuboid_number</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">] &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> == </span><span class="identifier-syntax">k</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="constant-syntax">lcon_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax"> = </span><span class="identifier-syntax">set</span><span class="plain-syntax">[</span><span class="identifier-syntax">k</span><span class="plain-syntax">], </span><span class="identifier-syntax">B</span><span class="plain-syntax"> = </span><span class="identifier-syntax">set</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">];</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="3-lc.html#SP13" class="function-link"><span class="function-syntax">Lcon::same_but_for_value_on_axis</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">d</span><span class="plain-syntax">, </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">                    (</span><span class="identifier-syntax">v</span><span class="plain-syntax"> == </span><a href="3-lc.html#SP13" class="function-link"><span class="function-syntax">Lcon::get_value_on_axis</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">d</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">enlarged</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">] == -1) {</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">enlarged</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">] = </span><span class="identifier-syntax">cuboid</span><span class="plain-syntax">; </span><span class="identifier-syntax">elongation</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">found</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">allow</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-lc.html#SP16_1_1_1">&#167;16.1.1.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP16_1_2" class="paragraph-anchor"></a><b>&#167;16.1.2. </b>And finally, but also not quite trivially, printing out the cuboid. We
handle the elongated sides differently from the unelongated ones, which
are relegated to the <a href="3-lc.html#SP12" class="internal">Lcon::write</a> call at the end. Note that this prints
nothing if <span class="extract"><span class="extract-syntax">remainder</span></span> is zero.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Write the resulting cuboid out</span><span class="named-paragraph-number">16.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">unelongated_sides</span><span class="plain-syntax"> = </span><span class="identifier-syntax">desiderata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">d</span><span class="plain-syntax">=1; </span><span class="identifier-syntax">d</span><span class="plain-syntax">&lt;128; </span><span class="identifier-syntax">d</span><span class="plain-syntax">=</span><span class="identifier-syntax">d</span><span class="plain-syntax">*2) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">elongated_sides</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">d</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">unelongated_sides</span><span class="plain-syntax"> = </span><span class="identifier-syntax">unelongated_sides</span><span class="plain-syntax"> - </span><span class="identifier-syntax">d</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">values</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_LCON_SET_SIZE</span><span class="plain-syntax">];</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">=0, </span><span class="identifier-syntax">vc</span><span class="plain-syntax">=0, </span><span class="identifier-syntax">terms</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">set_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cuboid_number</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">] == </span><span class="identifier-syntax">cuboid</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">v</span><span class="plain-syntax"> = </span><a href="3-lc.html#SP13" class="function-link"><span class="function-syntax">Lcon::get_value_on_axis</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">d</span><span class="plain-syntax">, </span><span class="identifier-syntax">set</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">already_listed</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">vc</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">++) </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">v</span><span class="plain-syntax"> == </span><span class="identifier-syntax">values</span><span class="plain-syntax">[</span><span class="identifier-syntax">x</span><span class="plain-syntax">]) </span><span class="identifier-syntax">already_listed</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">already_listed</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">terms</span><span class="plain-syntax">++ &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"/"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="3-lc.html#SP13" class="function-link"><span class="function-syntax">Lcon::write_value_on_axis</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">d</span><span class="plain-syntax">, </span><span class="identifier-syntax">v</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">values</span><span class="plain-syntax">[</span><span class="identifier-syntax">vc</span><span class="plain-syntax">++] = </span><span class="identifier-syntax">v</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="3-lc.html#SP12" class="function-link"><span class="function-syntax">Lcon::write</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">set</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">], </span><span class="identifier-syntax">unelongated_sides</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-lc.html#SP16_1">&#167;16.1</a>.</li></ul>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="2-plr.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-im.html">1</a></li><li class="progresschapter"><a href="2-tai.html">2</a></li><li class="progresscurrentchapter">3</li><li class="progresscurrent">lc</li><li class="progresssection"><a href="3-lc2.html">lc2</a></li><li class="progresssection"><a href="3-dcl.html">dcl</a></li><li class="progresssection"><a href="3-vc.html">vc</a></li><li class="progresschapter"><a href="4-dl.html">4</a></li><li class="progressnext"><a href="3-lc2.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

